<HTML><HEAD><TITLE>flatten_array(+Array, -List)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Term Manipulation</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>flatten_array(+Array, -List)</H1>
Returns a flat list of the elements of a multi-dimensional array.
<DL>
<DT><EM>Array</EM></DT>
<DD>Array.
</DD>
<DT><EM>List</EM></DT>
<DD>List of terms.
</DD>
</DL>
<H2>Description</H2>
   List is unified with a flat list of the elements of the array Array.  The
   elements are returned in the same order as they would be encountered in a
   depth-first left-to-right traversal of the array structure.

<H3>Modes and Determinism</H3><UL>
<LI>flatten_array(+, -) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Array is a variable.
<DT><EM>(5) type error </EM>
<DD>Array is not an array.
</DL>
<H2>Examples</H2>
<PRE>
?- flatten_array([]([](a,b,c),[](d,e,f)), List).
List = [a, b, c, d, e, f]
yes.
?- flatten_array([](a,b,c), List).
List = [a, b, c]
yes.
?- flatten_array([](a(b),[c,d],[]), List).
List = [a(b), [c, d], []]
yes.
?- flatten_array(Array, List).
instantiation fault in flatten_array(Array, List)
Abort
?- flatten_array([a,b,c], List).
type error in flatten_array([a,b,c], List)
Abort
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/termmanip/dim-2.html">dim / 2</A>, <A HREF="../../kernel/termmanip/subscript-3.html">subscript / 3</A>, <A HREF="../../lib/lists/flatten-2.html">lists : flatten / 2</A>
</BODY></HTML>
